package com.xzx.study;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MessageHandlerActivity extends AppCompatActivity implements View.OnClickListener {

    private Button test_handler;
    private Button handler_demo;
    private Button async_task;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_message_handler);

        test_handler = findViewById(R.id.test_handler);
        handler_demo = findViewById(R.id.handler_demo);
        async_task = findViewById(R.id.async_task);

        test_handler.setOnClickListener(this);
        handler_demo.setOnClickListener(this);
        async_task.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        if (v.getId() == test_handler.getId()) {
            startActivity(new Intent(this, TestHandlerActivity.class));
        } else if (v.getId() == handler_demo.getId()) {
            startActivity(new Intent(this, HandlerDemoActivity.class));
        } else if (v.getId() == async_task.getId()) {
            startActivity(new Intent(this, AsyncTaskActivity.class));
        }
    }
}
